<?php
    $store = Mage::app()->getStore();
    $code  = $store->getCode();
    $_productCollection=$this->getLoadedProductCollection();
    $_helper = $this->helper('catalog/output');
    $aspect_ratio = Mage::getStoreConfig("porto_settings/category/aspect_ratio",$code);
    $ratio_width = Mage::getStoreConfig("porto_settings/category/ratio_width",$code);
    $ratio_height = Mage::getStoreConfig("porto_settings/category/ratio_height",$code);
    
    if(!$ratio_width)
        $ratio_width = 300;
    if(!$ratio_height)
        $ratio_height = 400;
?>
<?php if(!$_productCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
<div class="filter-products">
    <?php $_collectionSize = $_productCollection->count() ?>
    <div class="products small-list">
    <?php $i=0; foreach ($_productCollection as $_product): ?>
    <?php $product = $_product; //Mage::getModel('catalog/product')->load($_product->getId()); ?>
            <div class="item"><div class="item-area">
                <div class="product-image-area">
                    <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
                        <img src="<?php if($aspect_ratio):?><?php echo $this->helper('catalog/image')->init($_product, 'small_image')->constrainOnly(FALSE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize($ratio_width);?><?php else: ?><?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($ratio_width,$ratio_height); ?><?php endif; ?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"/>
                    </a>
                </div>
                <div class="details-area">
                    <h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
                    <?php if(Mage::getStoreConfig("porto_settings/category/rating_star", $code)):?>
                    <?php if (Mage::helper('catalog')->isModuleEnabled('Mage_Review')): ?>
                    <?php 
                        $review_html = $this->getReviewsSummaryHtml($_product, 'short');
                        if($review_html){
                            echo $review_html;
                        }else{
                    ?>
                        <div class="ratings">
                            <div class="rating-box">
                                <div class="rating" style="width:0"></div>
                            </div>
                        </div>
                    <?php                            
                        }
                    ?>
                    <?php else: ?>
                        <div class="ratings">
                            <div class="rating-box">
                                <div class="rating" style="width:0"></div>
                            </div>
                        </div>
                    <?php endif; ?>
                    <?php endif; ?>
                    <?php if(Mage::getStoreConfig("porto_settings/category/product_price", $code)):?>
                    <?php echo $this->getPriceHtml($_product, true) ?>
                    <?php endif; ?>
                </div>
                <div class="clearer"></div>
            </div></div>
        <?php endforeach ?>
        </div>
</div>
<?php endif; ?>